using System;
using System.Windows.Forms;

namespace WillStott.MxAppToolbox
{
	/// <summary>
	/// Summary description for MenuOps.
	/// </summary>
	public class MenuOps
	{
		/// <summary>
		/// Switch control between visible and invisible then update the corresponding menu item
		/// </summary>
		/// <param name="ctrl">control to be set visible or not</param>
		/// <param name="menu">menu item to show visibility of control</param>
		public static void ToggleShow(Control ctrl, ToolStripMenuItem menu)
		{
			if ( menu.Checked == true)
			{
				menu.Checked = false;
				ctrl.Visible = false;
			}
			else
			{
				menu.Checked = true;
				ctrl.Visible = true;				
			}
		}
	}
}
